Technical details
library(GeoPressureR)
library(leaflet)
library(leaflet.extras)
library(raster)
library(dplyr)
library(ggplot2)
library(kableExtra)
library(plotly)
library(GeoLocTools)
setupGeolocation()
knitr::opts_chunk$set(echo = FALSE)
load(paste0("../data/1_pressure/", params$gdl_id, "_pressure_prob.Rdata"))
load(paste0("../data/2_light/", params$gdl_id, "_light_prob.Rdata"))
load(paste0("../data/3_static/", params$gdl_id, "_static_prob.Rdata"))
load(paste0("../data/4_basic_graph/", params$gdl_id, "_basic_graph.Rdata"))
load(paste0("../data/5_wind_graph/", params$gdl_id, "_wind_graph.Rdata"))
col <- rep(RColorBrewer::brewer.pal(8, "Dark2"), times = ceiling(max(pam$sta$sta_id) / 8))
All the results produced here are generated with (1) the raw geolocator data, (2) the labeled files of pressure and light and (3) the parameters listed below.
kable(gpr) %>% scroll_box(width = "100%")
| gdl_id | keep | crop_start | crop_end | thr_dur | extent_N | extent_W | extent_S | extent_E | map_scale | map_max_sample | map_margin | prob_map_s | prob_map_s_calib | prob_map_thr | shift_k | kernel_adjust | calib_lon | calib_lat | calib_1_start | calib_1_end | calib_2_start | calib_2_end | calib_2_lon | calib_2_lat | prob_light_w | thr_prob_percentile | thr_gs | thr_as | RingNo | scientific_name | common_name | mass | wing_span | Color | sta_id_winter |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 26IM | 9 | 2020-07-14 | 2021-05-28 | 0 | 51 | -18 | 5 | 16 | 4 | 300 | 30 | 1 | 1.3 | 0.9 | 0 | 1.4 | 8.705503 | 46.55076 | 2020-07-14 | 2020-09-17 | 2021-05-03 | 2021-05-28 | NA | NA | 0.09 | 0.95 | 120 | 100 | N643042 | Oenanthe oenanthe | Northern wheatear | NA | NA | #636EFA | 16 |
The labeling of pressure data is illustrated with this figure. The black dots indicates the pressure datapoint not considered in the matching. Each stationary period is illustrated by a different colored line.
pressure_na <- pam$pressure %>%
mutate(obs = ifelse(isoutlier | sta_id == 0, NA, obs))
p <- ggplot() +
geom_line(data = pam$pressure, aes(x = date, y = obs), colour = "grey") +
# geom_point(data = subset(pam$pressure, isoutlier), aes(x = date, y = obs), colour = "black") +
# geom_line(data = pressure_na, aes(x = date, y = obs, color = factor(sta_id)), size = 0.5) +
geom_line(data = do.call("rbind", shortest_path_timeserie) %>% filter(sta_id > 0), aes(x = date, y = pressure0, col = factor(sta_id))) +
theme_bw() +
scale_colour_manual(values = col) +
scale_y_continuous(name = "Pressure(hPa)")
ggplotly(p, dynamicTicks = T) %>% layout(showlegend = F)
pressure_ts_bind <- do.call("rbind", shortest_path_timeserie) %>%
filter(!is.na(sta_id))
pam$pressure %>%
left_join(pressure_ts_bind %>% dplyr::select(c("date", "pressure0")), by = "date") %>%
mutate(diff = ifelse(is.na(pressure0), 0, obs - pressure0)) %>%
filter(sta_id > 0 & !isoutlier) %>%
group_by(sta_id) %>%
mutate(sta_id = paste0(sta_id, " (SD=", round(sd(diff), 2), " ; N=", n(), ")")) %>%
ggplot(aes(x = diff)) +
geom_histogram(aes(y = (..count..) / tapply(..count.., ..PANEL.., sum)[..PANEL..]), binwidth = .2) +
facet_wrap(~sta_id) +
scale_x_continuous(name = "Pressure Geolocator - best match ERA5 (hPa)") +
scale_y_continuous(name = "Normalized histogram")
raw_geolight <- pam$light %>%
transmute(
Date = date,
Light = obs
)
lightImage(tagdata = raw_geolight, offset = 0)
tsimagePoints(twl$twilight,
offset = 0, pch = 16, cex = 1.2,
col = ifelse(twl$deleted, "grey20", ifelse(twl$rise, "firebrick", "cornflowerblue"))
)
abline(v = gpr$calib_2_start, lty = 1, col = "firebrick", lwd = 1.5)
abline(v = gpr$calib_1_start, lty = 1, col = "firebrick", lwd = 1.5)
abline(v = gpr$calib_2_end, lty = 2, col = "firebrick", lwd = 1.5)
abline(v = gpr$calib_1_end, lty = 2, col = "firebrick", lwd = 1.5)
The probability map resulting from light data alone can be seen below.
li_s <- list()
l <- leaflet(width = "100%") %>%
addProviderTiles(providers$Stamen.TerrainBackground) %>%
addFullscreenControl()
for (i_r in seq_len(length(light_prob))) {
i_s <- metadata(light_prob[[i_r]])$sta_id
info <- pam$sta[pam$sta$sta_id == i_s, ]
info_str <- paste0(i_s, " | ", info$start, "->", info$end)
li_s <- append(li_s, info_str)
l <- l %>% addRasterImage(light_prob[[i_r]], opacity = 0.8, colors = "OrRd", group = info_str)
}
l %>%
addCircles(lng = gpr$calib_lon, lat = gpr$calib_lat, color = "black", opacity = 1) %>%
addLayersControl(
overlayGroups = li_s,
options = layersControlOptions(collapsed = FALSE)
) %>%
hideGroup(tail(li_s, length(li_s) - 1))
We can compare light and pressure location at long stationary stopover (>5 days). By assuming the best match of the pressure to be the truth, we can plot the histogram of the zenith angle and compare to the fit of kernel density at the calibration site.
raw_geolight <- pam$light %>%
transmute(
Date = date,
Light = obs
)
dur <- unlist(lapply(pressure_prob, function(x) difftime(metadata(x)$temporal_extent[2],metadata(x)$temporal_extent[1], units = "days" )))
long_id <- which(dur>5)
par(mfrow = c(2, 3))
for (i_s in long_id){
twl_fl <- twl %>%
filter(!deleted) %>%
filter(twilight>shortest_path_timeserie[[i_s]]$date[1] & twilight<tail(shortest_path_timeserie[[i_s]]$date,1))
sun <- solar(twl_fl$twilight)
z_i <- refracted(zenith(sun, shortest_path_timeserie[[i_s]]$lon[1], shortest_path_timeserie[[i_s]]$lat[1]))
hist(z_i, freq = F, main = paste0("sta_id=",i_s, " | ",nrow(twl_fl),"twls"))
lines(fit_z, col = "red")
xlab("Zenith angle")
}
Similarly, we can plot the line of sunrise/sunset at the best match of pressure (yellow line) and compare to the raw and labeled light data.
lightImage(
tagdata = raw_geolight,
offset = gpr$shift_k / 60 / 60
)
tsimagePoints(twl$twilight,
offset = gpr$shift_k / 60 / 60, pch = 16, cex = 1.2,
col = ifelse(twl$deleted, "grey20", ifelse(twl$rise, "firebrick", "cornflowerblue"))
)
for (ts in shortest_path_timeserie){
twl_fl <- twl %>%
filter(twilight>ts$date[1] & twilight<tail(ts$date,1))
if (nrow(twl_fl)>0){
tsimageDeploymentLines(twl_fl$twilight,
lon = ts$lon[1], ts$lat[1],
offset = gpr$shift_k / 60 / 60, lwd = 3,col = adjustcolor("orange", alpha.f = 0.5))
}
}
| …1 | sta_id_s | sta_id_t | flight_duration | as_m | as_s | gs_m | gs_s | ws_m | ws_s | dist_m | dist_s | ws_m_support | ws_m_drift | start_flight | end_flight | sunrise | sunset | as_sp | gs_sp | ws_sp | dist_sp | ws_sp_support | ws_sp_drift | alt_min | alt_max | alt_mean | alt_med | alt_sumdabsdiff | alt_sumposdiff | gdl_id |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 1 | 2 | 8.0 | 38.44546 | 9.804338 | 48.75645 | 11.371858 | 11.381807 | 4.5896903 | 390.05162 | 90.97487 | 10.5492088 | 4.273140 | 2020-09-16 18:00:00 | 2020-09-17 02:00:00 | 2020-09-17 04:57:02 | 2020-09-16 18:04:51 | 41.76022 | 55.93640 | 16.881902 | 447.49120 | 14.9273423 | 7.8849904 | 1326.746467 | 3692.9111 | 2564.9621 | 2572.3228 | 6009.8034 | 2670.5919 | 26IM |
| 2 | 2 | 3 | 3.0 | 34.26814 | 16.051918 | 32.57591 | 16.572495 | 9.205904 | 2.7622863 | 97.72772 | 49.71748 | -0.4354046 | 9.195602 | 2020-09-17 18:30:00 | 2020-09-17 21:30:00 | 2020-09-18 04:59:50 | 2020-09-17 18:19:48 | 33.32318 | 28.57082 | 9.712767 | 85.71247 | -3.4966542 | 9.0615259 | 385.990928 | 4120.3701 | 2709.4552 | 3248.9909 | 6424.8419 | 2690.4627 | 26IM |
| 3 | 3 | 4 | 0.5 | 32.71884 | 21.291929 | 34.88579 | 26.650072 | 10.317075 | 4.3466711 | 17.44289 | 13.32504 | 3.6252221 | 9.659183 | 2020-09-18 20:30:00 | 2020-09-18 21:00:00 | 2020-09-19 05:01:59 | 2020-09-18 18:18:19 | 30.15767 | 40.35480 | 10.498521 | 20.17740 | 10.2744155 | 2.1576228 | 265.884562 | 857.0156 | 561.4501 | 561.4501 | 591.1310 | 0.0000 | 26IM |
| 4 | 4 | 5 | 1.0 | 31.02274 | 14.785335 | 29.03919 | 21.830757 | 20.188789 | 10.3419456 | 29.03919 | 21.83076 | 4.9665877 | 19.568347 | 2020-09-19 21:00:00 | 2020-09-19 22:00:00 | 2020-09-20 05:05:18 | 2020-09-19 18:17:27 | 30.20256 | 49.05843 | 19.093516 | 49.05843 | 18.9477866 | 2.3545121 | 47.869772 | 360.1404 | 200.9374 | 194.8020 | 312.2706 | 0.0000 | 26IM |
| 5 | 5 | 6 | 9.0 | 47.30193 | 20.423458 | 41.67277 | 19.826434 | 8.500212 | 4.0507183 | 375.05490 | 178.43791 | -5.1424441 | 6.768225 | 2020-09-21 18:30:00 | 2020-09-22 03:30:00 | 2020-09-22 05:17:40 | 2020-09-21 18:15:36 | 34.41825 | 32.14229 | 5.790611 | 289.28062 | -1.8349279 | 5.4921957 | 48.730991 | 2092.5218 | 1004.0967 | 832.2751 | 6471.3157 | 2843.8858 | 26IM |
| 6 | 6 | 7 | 8.0 | 48.44992 | 23.170336 | 39.64315 | 24.563565 | 14.537876 | 5.3427690 | 317.14518 | 196.50852 | -7.1193348 | 12.675366 | 2020-09-22 18:30:00 | 2020-09-23 02:30:00 | 2020-09-23 05:25:29 | 2020-09-22 18:21:43 | 37.66855 | 29.02755 | 14.340741 | 232.22038 | -6.3846980 | 12.8410471 | 478.831709 | 2430.8651 | 1128.6348 | 1026.7389 | 4800.9803 | 2482.7667 | 26IM |
| 7 | 7 | 8 | 0.5 | 33.75167 | 16.003071 | 28.96387 | 33.806102 | 29.370808 | 6.7105288 | 14.48194 | 16.90305 | 9.7082218 | 27.719935 | 2020-09-23 19:00:00 | 2020-09-23 19:30:00 | 2020-09-24 05:26:26 | 2020-09-23 18:25:15 | 30.82228 | 0.00000 | 30.822281 | 0.00000 | NA | NA | 443.833072 | 2417.1014 | 1430.4672 | 1430.4672 | 1973.2683 | 0.0000 | 26IM |
| 8 | 8 | 9 | 9.0 | 41.97030 | 12.164199 | 64.93564 | 18.105592 | 31.095416 | 10.7557069 | 584.42074 | 162.95033 | 26.3496003 | 16.511313 | 2020-09-25 18:30:00 | 2020-09-26 03:30:00 | 2020-09-26 05:21:23 | 2020-09-25 18:21:58 | 32.29474 | 55.96868 | 24.788329 | 503.71814 | 24.1564082 | 5.5614047 | 4.162741 | 2646.0933 | 1024.5108 | 1066.9558 | 7424.9011 | 4324.1802 | 26IM |
| 9 | 9 | 10 | 0.5 | 31.90757 | 14.961364 | 45.93178 | 23.596933 | 36.215451 | 4.8770883 | 22.96589 | 11.79847 | 26.1604760 | 25.043729 | 2020-09-26 21:00:00 | 2020-09-26 21:30:00 | 2020-09-27 05:21:09 | 2020-09-26 18:11:23 | 16.83249 | 45.43486 | 34.740001 | 22.71743 | 32.8807163 | 11.2127696 | 1217.415143 | 1908.9952 | 1563.2052 | 1563.2052 | 691.5801 | 0.0000 | 26IM |
| 10 | 10 | 11 | 10.0 | 46.06701 | 10.706761 | 73.34564 | 9.845241 | 28.901678 | 2.4432046 | 733.45644 | 98.45241 | 27.9002346 | 7.542141 | 2020-10-05 18:00:00 | 2020-10-06 04:00:00 | 2020-10-06 05:32:54 | 2020-10-05 17:57:39 | 37.49903 | 68.01423 | 31.069805 | 680.14225 | 30.7662852 | 4.3322628 | 557.576491 | 1784.4923 | 1057.2231 | 935.0307 | 2663.6428 | 1093.0468 | 26IM |
| 11 | 11 | 12 | 12.5 | 39.71797 | 12.188840 | 64.31377 | 12.823144 | 25.651547 | 2.6645073 | 803.92212 | 160.28930 | 25.0082206 | 5.708834 | 2020-10-06 18:00:00 | 2020-10-07 06:30:00 | 2020-10-07 05:39:40 | 2020-10-06 18:03:37 | 35.67554 | 61.92926 | 26.381519 | 774.11579 | 26.3080328 | 1.9677309 | 324.847614 | 3234.6410 | 1821.7096 | 2351.5534 | 9438.5425 | 4737.1830 | 26IM |
| 12 | 12 | 13 | 11.0 | 42.91235 | 19.990682 | 54.79321 | 19.808003 | 20.580411 | 9.3787712 | 602.72531 | 217.88803 | 14.4578080 | 14.646676 | 2020-10-07 18:30:00 | 2020-10-08 05:30:00 | 2020-10-08 05:35:20 | 2020-10-07 18:12:22 | 35.23654 | 53.31554 | 26.302849 | 586.47091 | 21.5019207 | 15.1494973 | 540.328829 | 3611.0373 | 2257.1709 | 2564.8913 | 10764.9170 | 5957.2986 | 26IM |
| 13 | 13 | 14 | 10.0 | 53.48568 | 21.467619 | 49.30647 | 20.874522 | 7.179562 | 2.3711281 | 493.06472 | 208.74522 | -3.8336170 | 6.070378 | 2020-10-08 19:30:00 | 2020-10-09 05:30:00 | 2020-10-09 05:22:31 | 2020-10-08 18:10:14 | 51.67562 | 44.23648 | 7.505599 | 442.36477 | -7.4279184 | 1.0770530 | 282.919060 | 2449.1111 | 1287.2820 | 1327.4175 | 9772.0286 | 4635.0039 | 26IM |
| 14 | 14 | 15 | 2.5 | 31.48530 | 15.295274 | 32.57346 | 17.284253 | 4.472537 | 1.2160883 | 81.43366 | 43.21063 | 1.3770445 | 4.255272 | 2020-10-10 02:00:00 | 2020-10-10 04:30:00 | 2020-10-10 05:19:44 | 2020-10-09 17:58:33 | 29.71275 | 34.14474 | 4.527460 | 85.36186 | 4.4445134 | 0.8626653 | 306.722077 | 432.4263 | 377.1620 | 389.8806 | 238.7801 | 125.7042 | 26IM |
| 15 | 15 | 16 | 1.5 | 26.84548 | 14.130277 | 27.08813 | 16.406363 | 7.775349 | 0.9737904 | 40.63219 | 24.60954 | 1.3574712 | 7.655934 | 2020-10-10 22:30:00 | 2020-10-11 00:00:00 | 2020-10-11 05:17:51 | 2020-10-10 17:54:48 | 29.37444 | 35.87090 | 7.126289 | 53.80634 | 6.6160527 | 2.6479881 | 263.765490 | 425.7458 | 316.9073 | 289.0590 | 321.9771 | 159.9967 | 26IM |
| 16 | 16 | 17 | 10.5 | 30.82062 | 8.852794 | 31.67531 | 14.247368 | 33.528356 | 1.3382357 | 332.59073 | 149.59736 | 18.5880631 | 27.904024 | 2021-04-01 18:30:00 | 2021-04-02 05:00:00 | 2021-04-02 05:32:59 | 2021-04-01 18:22:18 | 31.41739 | 34.47421 | 33.825683 | 361.97925 | 19.5159749 | 27.6279491 | 208.015614 | 3274.7985 | 1584.3214 | 1563.2039 | 9771.3308 | 4896.1005 | 26IM |
| 17 | 17 | 18 | 13.0 | 43.10631 | 14.982266 | 47.79141 | 13.053744 | 23.473868 | 3.8061580 | 621.28830 | 169.69868 | 10.2203219 | 21.132144 | 2021-04-02 18:30:00 | 2021-04-03 07:30:00 | 2021-04-03 05:45:04 | 2021-04-02 18:35:13 | 38.38139 | 44.15370 | 24.908726 | 573.99810 | 12.4209600 | 21.5908401 | 222.119740 | 4566.7993 | 1755.2097 | 1639.5668 | 18690.5892 | 9365.3884 | 26IM |
| 18 | 18 | 19 | 21.0 | 47.52094 | 17.226328 | 84.82451 | 10.675709 | 45.351775 | 10.8046636 | 1781.31460 | 224.18988 | 41.2247666 | 18.902437 | 2021-04-03 19:00:00 | 2021-04-04 16:00:00 | 2021-04-04 04:52:48 | 2021-04-03 18:52:37 | 36.40976 | 82.58790 | 51.282471 | 1734.34584 | 49.1899055 | 14.4998291 | 158.821632 | 3769.9195 | 2346.4099 | 2499.0195 | 18296.7144 | 8897.6505 | 26IM |
| 19 | 19 | 20 | 3.0 | 35.14390 | 15.974203 | 29.38300 | 15.773331 | 9.440577 | 4.0589541 | 88.14899 | 47.31999 | -4.8090535 | 8.123884 | 2021-04-05 00:30:00 | 2021-04-05 03:30:00 | 2021-04-05 04:50:46 | 2021-04-04 18:20:34 | 29.12917 | 27.72612 | 8.447643 | 83.17835 | -0.1516371 | 8.4462822 | 138.829670 | 2538.6465 | 1848.1124 | 2339.5202 | 4265.4646 | 1759.2867 | 26IM |
| 20 | 20 | 21 | 5.0 | 39.87572 | 9.179918 | 44.16379 | 10.524302 | 11.923304 | 3.2076897 | 220.81894 | 52.62151 | 5.6894192 | 10.478344 | 2021-04-06 19:30:00 | 2021-04-07 00:30:00 | 2021-04-07 04:43:30 | 2021-04-06 18:22:49 | 29.96352 | 36.03931 | 13.324628 | 180.19655 | 8.0268629 | 10.6355627 | 256.791216 | 1372.4299 | 756.1969 | 653.2322 | 2973.4207 | 1623.7821 | 26IM |
| 21 | 21 | 22 | 1.0 | 30.96389 | 15.520433 | 35.36037 | 16.932450 | 21.652824 | 4.0136778 | 35.36037 | 16.93245 | 10.7526912 | 18.794266 | 2021-04-07 05:30:00 | 2021-04-07 06:30:00 | 2021-04-07 04:41:13 | 2021-04-06 18:21:24 | 27.99082 | 53.40981 | 25.466712 | 53.40981 | 25.4417247 | 1.1278602 | 1133.608354 | 1271.5705 | 1209.7779 | 1224.1548 | 185.3779 | 137.9622 | 26IM |
| 22 | 22 | 23 | 1.5 | 30.50076 | 13.762845 | 37.19461 | 19.705873 | 32.180960 | 1.9028052 | 55.79192 | 29.55881 | 20.0130752 | 25.201012 | 2021-04-21 18:30:00 | 2021-04-21 20:00:00 | 2021-04-22 04:20:14 | 2021-04-21 18:32:34 | 27.95237 | 36.98249 | 32.486246 | 55.47373 | 22.1959819 | 23.7211833 | 1235.174838 | 2586.3149 | 1848.6267 | 1786.5085 | 2605.7130 | 1254.5729 | 26IM |
| 23 | 23 | 24 | 9.5 | 86.45337 | 4.960686 | 95.72122 | 4.351167 | 9.755181 | 1.9773638 | 909.35156 | 41.33608 | 9.3162719 | 2.893204 | 2021-04-24 19:00:00 | 2021-04-25 04:30:00 | 2021-04-25 04:06:12 | 2021-04-24 18:36:09 | 77.11822 | 88.69483 | 11.588936 | 842.60093 | 11.5782200 | 0.4982484 | 163.578988 | 3319.0815 | 1397.7146 | 1173.4355 | 6247.9391 | 2198.8259 | 26IM |
| 24 | 24 | 25 | 3.0 | 31.83508 | 20.042877 | 32.34688 | 20.381341 | 4.394927 | 2.1657492 | 97.04064 | 61.14402 | 0.8063113 | 4.320329 | 2021-04-25 09:00:00 | 2021-04-25 12:00:00 | 2021-04-25 04:00:39 | 2021-04-24 18:58:16 | 40.51437 | 42.17435 | 1.969965 | 126.52305 | 1.6733223 | 1.0395934 | -49.358714 | 568.9780 | 287.1836 | 284.7488 | 831.7452 | 213.4085 | 26IM |
| 25 | 25 | 26 | 6.0 | 38.70119 | 11.577197 | 39.63352 | 11.369465 | 2.606847 | 1.9835443 | 237.80112 | 68.21679 | 1.0070928 | 2.404458 | 2021-04-30 19:00:00 | 2021-05-01 01:00:00 | 2021-05-01 03:43:28 | 2021-04-30 19:05:43 | 31.08300 | 29.48551 | 1.974277 | 176.91308 | -1.5746644 | 1.1908821 | 286.626717 | 1203.9795 | 645.3263 | 644.8759 | 3275.3127 | 1725.0887 | 26IM |
| 26 | 26 | 27 | 5.0 | 38.00505 | 12.923229 | 30.29100 | 12.271300 | 10.226765 | 2.4928186 | 151.45500 | 61.35650 | -6.9699387 | 7.483761 | 2021-05-02 19:30:00 | 2021-05-03 00:30:00 | 2021-05-03 03:33:52 | 2021-05-02 19:10:04 | 28.43607 | 25.07181 | 7.804989 | 125.35903 | -2.3751147 | 7.4348289 | 154.292651 | 2419.7559 | 1580.8931 | 1740.0417 | 6642.2029 | 4246.2442 | 26IM |